/*
 * Created by JFormDesigner on Mon Mar 20 21:35:53 CST 2023
 */

package com.viking.gui.catchspermmaininterface;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import com.viking.gui.enterinformation.PatientInformation;
import com.viking.gui.experiment.Experiment;
import com.viking.gui.experimentequipment.ExperimentEquipment;
import com.viking.gui.sampledataenterinformation.SampleDataEnterInformation;
import com.viking.gui.sampledetail.SampleDetail;
import com.viking.gui.samplesperm.SampleSperm;
import com.viking.gui.setting.Setting;
import com.viking.gui.userinformation.UserInformation;

/**
 * @author 86137
 */
public class CatchSpermMainInterface extends JFrame {
    public CatchSpermMainInterface() {
        initComponents();
    }

    private void exitMenuItem(ActionEvent e) {
        // TODO add your code here
        System.exit(0);
    }

    private void labViewStartMenuItem(ActionEvent e) {
        // TODO add your code here
        System.out.println("LabView start!");
    }
    private void sampledataenterinformation(ActionEvent e) {
        // TODO add your code here
        SwingUtilities.invokeLater(
                new Runnable() {
                    @Override
                    public void run() {
                        // 此处处于 事件调度线程
                        SampleDataEnterInformation sampleDataEnterInformation = new SampleDataEnterInformation();
                        sampleDataEnterInformation.setVisible(true);
                    }
                }
        );

    }
    private void patientDetail(ActionEvent e) {
        // TODO add your code here
        PatientInformation patient = new PatientInformation();
        patient.setVisible(true);
    }

    private void sampleDetailOne(ActionEvent e) {
        // TODO add your code here
        SampleDataEnterInformation sampleData = new SampleDataEnterInformation();
        sampleData.setVisible(true);
    }

    private void spermDetailOne(ActionEvent e) {
        // TODO add your code here
        SampleSperm sampleSperm = new SampleSperm();
        sampleSperm.setVisible(true);
    }



    private void experimentDetail(ActionEvent e) {
        // TODO add your code here
        Experiment experiment = new Experiment();
        experiment.setVisible(true);
    }

    private void equipmentDetail(ActionEvent e) {
        // TODO add your code here
        ExperimentEquipment equipment = new ExperimentEquipment();
        equipment.setVisible(true);
    }

    private void userInformation(ActionEvent e) {
        // TODO add your code here
                // 此处处于 主线程，提交任务到 事件调度线程 创建窗口
                SwingUtilities.invokeLater(
                        new Runnable() {
                            @Override
                            public void run() {
                                // 此处处于 事件调度线程
                                UserInformation userInformation = new UserInformation();
                                userInformation.setVisible(true);
                            }
                        }
                );

    }

    private void patientInformation(ActionEvent e) {
        // TODO add your code here
        // 此处处于 主线程，提交任务到 事件调度线程 创建窗口
        SwingUtilities.invokeLater(
                new Runnable() {
                    @Override
                    public void run() {
                        // 此处处于 事件调度线程
                        PatientInformation patientInformation = new PatientInformation();
                        patientInformation.setVisible(true);
                    }
                }
        );

    }
    private void sampleDataEnterInformation(ActionEvent e) {
        // TODO add your code here
        // 此处处于 主线程，提交任务到 事件调度线程 创建窗口
        SwingUtilities.invokeLater(
                new Runnable() {
                    @Override
                    public void run() {
                        // 此处处于 事件调度线程
                        SampleDataEnterInformation sampleDataEnterInformation = new SampleDataEnterInformation();
                        sampleDataEnterInformation.setVisible(true);
                    }
                }
        );

    }
    private void sampleDetail(ActionEvent e) {
        // TODO add your code here
        // 此处处于 主线程，提交任务到 事件调度线程 创建窗口
        SwingUtilities.invokeLater(
                new Runnable() {
                    @Override
                    public void run() {
                        // 此处处于 事件调度线程
                        SampleDetail sampleDetail = new SampleDetail();
                        sampleDetail.setVisible(true);
                    }
                }
        );

    }
    private void experiment(ActionEvent e) {
        // TODO add your code here
        // 此处处于 主线程，提交任务到 事件调度线程 创建窗口
        SwingUtilities.invokeLater(
                new Runnable() {
                    @Override
                    public void run() {
                        // 此处处于 事件调度线程
                        Experiment experiment = new Experiment();
                        experiment.setVisible(true);
                    }
                }
        );

    }
    private void experimentEquipment(ActionEvent e) {
        // TODO add your code here
        // 此处处于 主线程，提交任务到 事件调度线程 创建窗口
        SwingUtilities.invokeLater(
                new Runnable() {
                    @Override
                    public void run() {
                        // 此处处于 事件调度线程
                        ExperimentEquipment experimentEquipment = new ExperimentEquipment();
                        experimentEquipment.setVisible(true);
                    }
                }
        );

    }






    private void settingServerInformation(ActionEvent e) {
        // TODO add your code here
        SwingUtilities.invokeLater(
                new Runnable() {
                    @Override
                    public void run() {
                        // 此处处于 事件调度线程
                        Setting setting = new Setting();
                        setting.setVisible(true);
                    }
                }
        );

    }



    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents  @formatter:off
        menuBar1 = new JMenuBar();
        menu1 = new JMenu();
        settingServerInformationMenuItem = new JMenuItem();
        exitMenuItem = new JMenuItem();
        menu6 = new JMenu();
        labViewMenuItem = new JMenuItem();
        userMenu = new JMenu();
        userInformationMenuItem = new JMenuItem();
        userSercurityMenuItem = new JMenuItem();
        patientMenu = new JMenu();
        patientDetailMenuItem = new JMenuItem();
        menu3 = new JMenu();
        menuItem1 = new JMenuItem();
        sampleDetailMenuItem = new JMenuItem();
        spermDetailMenuItem = new JMenuItem();
        menu4 = new JMenu();
        experimentDetailMenuItem = new JMenuItem();
        menu5 = new JMenu();
        equipmentMenuItem = new JMenuItem();
        checkBoxMenuItem1 = new JCheckBoxMenuItem();
        namelabel2 = new JLabel();
        label4 = new JLabel();
        scrollPane1 = new JScrollPane();
        projectDataStatisticstable1 = new JTable();
        joblabel3 = new JLabel();
        namelabel1 = new JLabel();
        joblabel2 = new JLabel();
        projectDataStatisticslabel3 = new JLabel();

        //======== this ========
        setTitle("\u6355\u7cbe\u8005");
        setResizable(false);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setMaximizedBounds(new Rectangle(200, 200, 0, 0));
        Container contentPane = getContentPane();
        contentPane.setLayout(null);

        //======== menuBar1 ========
        {

            //======== menu1 ========
            {
                menu1.setText("\u9996\u9875");
                menu1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));

                //---- settingServerInformationMenuItem ----
                settingServerInformationMenuItem.setText("\u8bbe\u7f6e");
                settingServerInformationMenuItem.addActionListener(e -> settingServerInformation(e));
                menu1.add(settingServerInformationMenuItem);

                //---- exitMenuItem ----
                exitMenuItem.setText("\u9000\u51fa");
                exitMenuItem.addActionListener(e -> exitMenuItem(e));
                menu1.add(exitMenuItem);
            }
            menuBar1.add(menu1);

            //======== menu6 ========
            {
                menu6.setText("LabView");
                menu6.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));

                //---- labViewMenuItem ----
                labViewMenuItem.setText("\u542f\u52a8\u673a\u5668\u4eba");
                labViewMenuItem.addActionListener(e -> labViewStartMenuItem(e));
                menu6.add(labViewMenuItem);
            }
            menuBar1.add(menu6);

            //======== userMenu ========
            {
                userMenu.setText("\u7528\u6237");
                userMenu.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));

                //---- userInformationMenuItem ----
                userInformationMenuItem.setText("\u7528\u6237\u4fe1\u606f");
                userInformationMenuItem.addActionListener(e -> userInformation(e));
                userMenu.add(userInformationMenuItem);

                //---- userSercurityMenuItem ----
                userSercurityMenuItem.setText("\u7528\u6237\u5b89\u5168");
                userMenu.add(userSercurityMenuItem);
            }
            menuBar1.add(userMenu);

            //======== patientMenu ========
            {
                patientMenu.setText("\u60a3\u8005\u4fe1\u606f");
                patientMenu.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));

                //---- patientDetailMenuItem ----
                patientDetailMenuItem.setText("\u4fe1\u606f\u7ba1\u7406");
                patientDetailMenuItem.addActionListener(e -> patientDetail(e));
                patientMenu.add(patientDetailMenuItem);
            }
            menuBar1.add(patientMenu);

            //======== menu3 ========
            {
                menu3.setText("\u6837\u672c\u7ba1\u7406");
                menu3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));

                //---- menuItem1 ----
                menuItem1.setText("\u6837\u672c\u4fe1\u606f");
                menuItem1.addActionListener(e -> sampleDataEnterInformation(e));
                menu3.add(menuItem1);

                //---- sampleDetailMenuItem ----
                sampleDetailMenuItem.setText("\u6837\u672c\u8be6\u60c5");
                sampleDetailMenuItem.addActionListener(e -> sampleDetail(e));
                menu3.add(sampleDetailMenuItem);

                //---- spermDetailMenuItem ----
                spermDetailMenuItem.setText("\u6837\u672c\u7cbe\u5b50");
                spermDetailMenuItem.addActionListener(e -> spermDetailOne(e));
                menu3.add(spermDetailMenuItem);
            }
            menuBar1.add(menu3);

            //======== menu4 ========
            {
                menu4.setText("\u5b9e\u9a8c\u4fe1\u606f");
                menu4.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));

                //---- experimentDetailMenuItem ----
                experimentDetailMenuItem.setText("\u5b9e\u9a8c\u7ba1\u7406");
                experimentDetailMenuItem.addActionListener(e -> experimentDetail(e));
                menu4.add(experimentDetailMenuItem);
            }
            menuBar1.add(menu4);

            //======== menu5 ========
            {
                menu5.setText("\u5b9e\u9a8c\u8bbe\u5907");
                menu5.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));

                //---- equipmentMenuItem ----
                equipmentMenuItem.setText("\u8bbe\u5907\u7ba1\u7406");
                equipmentMenuItem.addActionListener(e -> equipmentDetail(e));
                menu5.add(equipmentMenuItem);
            }
            menuBar1.add(menu5);
        }
        setJMenuBar(menuBar1);

        //---- checkBoxMenuItem1 ----
        checkBoxMenuItem1.setText("text");
        contentPane.add(checkBoxMenuItem1);
        checkBoxMenuItem1.setBounds(920, 216, checkBoxMenuItem1.getPreferredSize().width, 0);

        //---- namelabel2 ----
        namelabel2.setText("\u59d3\u540d\uff1a");
        contentPane.add(namelabel2);
        namelabel2.setBounds(55, 235, 48, namelabel2.getPreferredSize().height);

        //---- label4 ----
        label4.setFont(label4.getFont().deriveFont(label4.getFont().getStyle() | Font.ITALIC));
        label4.setIcon(new ImageIcon(getClass().getResource("/\u4eba\u50cf.jpg")));
        label4.setDisabledIcon(new ImageIcon(getClass().getResource("/\u4eba\u50cf.jpg")));
        contentPane.add(label4);
        label4.setBounds(new Rectangle(new Point(52, 45), label4.getPreferredSize()));

        //======== scrollPane1 ========
        {

            //---- projectDataStatisticstable1 ----
            projectDataStatisticstable1.setModel(new DefaultTableModel(
                new Object[][] {
                    {null, null, null, null, null, null},
                },
                new String[] {
                    "\u4eca\u65e5\u60a3\u8005", "\u4eca\u65e5\u5b9e\u9a8c", "\u672c\u5468\u60a3\u8005", "\u672c\u5468\u5b9e\u9a8c", "\u4f7f\u7528\u8bbe\u5907\u7d2f\u8ba1", "\u5e9f\u5f03\u5b9e\u9a8c\u7d2f\u8ba1"
                }
            ));
            scrollPane1.setViewportView(projectDataStatisticstable1);
        }
        contentPane.add(scrollPane1);
        scrollPane1.setBounds(199, 68, 528, 86);

        //---- joblabel3 ----
        joblabel3.setText("\u89d2\u8272\uff1a");
        contentPane.add(joblabel3);
        joblabel3.setBounds(55, 260, 48, 17);

        //---- namelabel1 ----
        namelabel1.setText("Admin");
        contentPane.add(namelabel1);
        namelabel1.setBounds(100, 235, 65, 15);

        //---- joblabel2 ----
        joblabel2.setText("\u7ba1\u7406\u5458");
        contentPane.add(joblabel2);
        joblabel2.setBounds(100, 260, 65, 15);

        //---- projectDataStatisticslabel3 ----
        projectDataStatisticslabel3.setText("\u9879\u76ee\u6570\u636e\u7edf\u8ba1");
        contentPane.add(projectDataStatisticslabel3);
        projectDataStatisticslabel3.setBounds(200, 45, 111, projectDataStatisticslabel3.getPreferredSize().height);

        {
            // compute preferred size
            Dimension preferredSize = new Dimension();
            for(int i = 0; i < contentPane.getComponentCount(); i++) {
                Rectangle bounds = contentPane.getComponent(i).getBounds();
                preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
            }
            Insets insets = contentPane.getInsets();
            preferredSize.width += insets.right;
            preferredSize.height += insets.bottom;
            contentPane.setMinimumSize(preferredSize);
            contentPane.setPreferredSize(preferredSize);
        }
        setSize(770, 390);
        setLocationRelativeTo(getOwner());
        // JFormDesigner - End of component initialization  //GEN-END:initComponents  @formatter:on
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables  @formatter:off
    private JMenuBar menuBar1;
    private JMenu menu1;
    private JMenuItem settingServerInformationMenuItem;
    private JMenuItem exitMenuItem;
    private JMenu menu6;
    private JMenuItem labViewMenuItem;
    private JMenu userMenu;
    private JMenuItem userInformationMenuItem;
    private JMenuItem userSercurityMenuItem;
    private JMenu patientMenu;
    private JMenuItem patientDetailMenuItem;
    private JMenu menu3;
    private JMenuItem menuItem1;
    private JMenuItem sampleDetailMenuItem;
    private JMenuItem spermDetailMenuItem;
    private JMenu menu4;
    private JMenuItem experimentDetailMenuItem;
    private JMenu menu5;
    private JMenuItem equipmentMenuItem;
    private JCheckBoxMenuItem checkBoxMenuItem1;
    private JLabel namelabel2;
    private JLabel label4;
    private JScrollPane scrollPane1;
    private JTable projectDataStatisticstable1;
    private JLabel joblabel3;
    private JLabel namelabel1;
    private JLabel joblabel2;
    private JLabel projectDataStatisticslabel3;
    // JFormDesigner - End of variables declaration  //GEN-END:variables  @formatter:on
}
